package org.doubango.ngn.h264

import android.annotation.TargetApi
import android.media.MediaCodec
import android.media.MediaFormat
import android.os.Build

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
fun MediaCodec.BufferInfo.dup(): MediaCodec.BufferInfo {
    val copy = MediaCodec.BufferInfo()
    copy.set(this.offset, this.size, this.presentationTimeUs, this.flags)
    return copy
}

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
class H264Data(@Suppress("SpellCheckingInspection") val h264Datas: ByteArray, bufferInfo: MediaCodec.BufferInfo, val mediaFormat: MediaFormat) {
    val bufferInfo: MediaCodec.BufferInfo = bufferInfo.dup()
}